function index_ = taskFineDiscrimination(varargin)
% A two-interval, two-alternative same/different task
%
%   index_ = taskFineDiscrimination(varargin)
%
%   On "same" trials, both intervals show a standard direction
%   On "different" trials, one interval shows a different direction;
%
%   asl eye tracker for monitoring but no enforcement
%   PMDHID levers for choices
%
%   index_ specifies the new instance in ROOT_STRUCT.dXtask

% copyright 2008 Benjamin Heasly University of Pennsylvania% This is a two-alternative, two-interval task.

% get struct of task arguments
rootArgs = varargin{1};
varargin(1) = [];

% name of this task
name = mfilename;

% eye-specific responses
respond = { ...
    'dXkbHID',  {'any', 'error'}; ...
    'dXPMDHID', {'any', 'error'}; ...
    'dXasl',    {[3,true,inf], 'left', [4,true,inf], 'right',true}};
left = { ...
    'dXkbHID',  {'any', 'error'}; ...
    'dXPMDHID', {'any', 'error'}; ...
    'dXasl',    {[3,false,inf], 'left', true}};
right = { ...
    'dXkbHID',  {'any', 'error'}; ...
    'dXPMDHID', {'any', 'error'}; ...
    'dXasl',    {[4,false,inf], 'right', true}};
stateArgs = {rootArgs, respond, left, right};

% get general task settings for modality tasks
arg_dXtask = fine_task_args;

% configure and create this dXtask instance
static = {'root', true, true, false};
index_ = rAdd('dXtask', 1, {'root', false, true, false}, ...
    'name',         name(5:end), ...
    'blockReps',    13, ...
    'timeLimit',    20*60, ...
    'bgColor',      rootArgs.bgColor, ...
    'helpers',      { ...
            'gXfine_motionControl', 1,  true,   {}; ...
            'gXfine_hardware',      1,  true,	{rootArgs}; ...
            'gXfine_graphics',      1,  true,	{rootArgs}; ...
            'gXfine_statelist',     1,  false,	stateArgs; ...
            }, ...
    arg_dXtask{:}, varargin{:});